const mongoose = require('mongoose')

const userSchema = new mongoose.Schema({
    username: {
        type: String, 
        maxlength: 20,
        minlength: 3,
        required: true,
        index: { unique: true }
    },
    nickname: {
        type: String, 
        maxlength: 20,
        minlength: 1,
        required: true,
    },
    password: {
        type: String,
        maxlength: 128,
        minlength: 6,
        required: true
    }
}, {timestamps: true})

mongoose.model('User', userSchema, 'user')